﻿using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;
using YArchitech.Revit;

namespace HYFloorPipeModule
{
	public class DrawSampleChart
	{
		public DrawSampleChart(Autodesk.Revit.DB.Document doc, Autodesk.Revit.DB.View view)
		{
			this.fpt = new FloorPipeTools(doc);
			this.doc = doc;
			this.view = view;
		}

		public void DrawOneModule(Autodesk.Revit.DB.Document doc, Autodesk.Revit.DB.View view, XYZ sPoint, XYZ ePoint)
		{
			Curve curve = doc.CreatYJKLine(sPoint, ePoint, true);
			DetailLine detailLine = doc.Create.NewDetailCurve(view, curve) as DetailLine;
			GraphicsStyle lineStyle = new FloorPipeTools(doc).GetLineStyle().FirstOrDefault((GraphicsStyle q) => q.Name == "<中心线>");
			detailLine.LineStyle = lineStyle;
			detailLine.LineStyle.Category.LineColor.Red = 67;
			detailLine.LineStyle.Category.LineColor.Green = 134;
			detailLine.LineStyle.Category.LineColor.Red = 188;
		}

		public DetailLine DrawDetailLine(XYZ sPoint, XYZ ePoint, string name)
		{
			Curve curve = this.doc.CreatYJKLine(sPoint, ePoint, true);
			DetailLine detailLine = this.doc.Create.NewDetailCurve(this.view, curve) as DetailLine;
			GraphicsStyle graphicsStyleByName = this.fpt.GetGraphicsStyleByName(name);
			detailLine.LineStyle = graphicsStyleByName;
			return detailLine;
		}

		public void DrawDetailArcLine(XYZ sPoint, string name)
		{
			XYZ endPnt = new XYZ(sPoint.X, sPoint.Y + 0.65616797900262469, sPoint.Z);
			XYZ radianPnt = new XYZ(sPoint.X + 0.16404199475065617, sPoint.Y + 0.32808398950131235, sPoint.Z);
			XYZ endPnt2 = new XYZ(sPoint.X, sPoint.Y - 0.65616797900262469, sPoint.Z);
			XYZ radianPnt2 = new XYZ(sPoint.X - 0.16404199475065617, sPoint.Y - 0.32808398950131235, sPoint.Z);
			Curve curve = this.doc.CreatYJKArc(sPoint, endPnt, radianPnt);
			Curve curve2 = this.doc.CreatYJKArc(sPoint, endPnt2, radianPnt2);
			DetailArc detailArc = this.doc.Create.NewDetailCurve(this.view, curve) as DetailArc;
			CurveElement curveElement = this.doc.Create.NewDetailCurve(this.view, curve2) as DetailArc;
			GraphicsStyle graphicsStyleByName = this.fpt.GetGraphicsStyleByName(name);
			detailArc.LineStyle = graphicsStyleByName;
			curveElement.LineStyle = graphicsStyleByName;
		}

		public void SplitLineByPoint(DetailLine dl, XYZ point, string name)
		{
			this.DrawDetailLine(dl.GeometryCurve.GetEndPoint(0), point, name);
			this.DrawDetailLine(dl.GeometryCurve.GetEndPoint(1), point, name);
			this.doc.DeleteElement(dl);
		}

		public void DrawOneFloor(XYZ basepoint, string[] names)
		{
			XYZ sPoint = new XYZ(basepoint.X - 3.2808398950131235, basepoint.Y + 1.6404199475065617, basepoint.Z);
			XYZ xyz = new XYZ(basepoint.X - 3.2808398950131235, basepoint.Y - 3.2808398950131235, basepoint.Z);
			XYZ xyz2 = new XYZ(basepoint.X - 4.9212598425196852, basepoint.Y + 1.6404199475065617, basepoint.Z);
			XYZ ePoint = new XYZ(basepoint.X - 4.9212598425196852, basepoint.Y - 3.2808398950131235, basepoint.Z);
			XYZ sPoint2 = new XYZ(basepoint.X - 3.2808398950131235, basepoint.Y, basepoint.Z);
			XYZ sPoint3 = new XYZ(basepoint.X - 3.2808398950131235, basepoint.Y - 1.6404199475065617, basepoint.Z);
			XYZ sPoint4 = new XYZ(basepoint.X - 4.9212598425196852, basepoint.Y, basepoint.Z);
			XYZ sPoint5 = new XYZ(basepoint.X - 4.9212598425196852, basepoint.Y - 1.6404199475065617, basepoint.Z);
			XYZ xyz3 = new XYZ(basepoint.X - 8.2020997375328086, basepoint.Y, basepoint.Z);
			XYZ xyz4 = new XYZ(basepoint.X - 8.2020997375328086, basepoint.Y - 1.6404199475065617, basepoint.Z);
			XYZ sPoint6 = new XYZ(basepoint.X + 3.2808398950131235, basepoint.Y + 1.6404199475065617, basepoint.Z);
			XYZ xyz5 = new XYZ(basepoint.X + 3.2808398950131235, basepoint.Y - 3.2808398950131235, basepoint.Z);
			XYZ xyz6 = new XYZ(basepoint.X + 4.9212598425196852, basepoint.Y + 1.6404199475065617, basepoint.Z);
			XYZ ePoint2 = new XYZ(basepoint.X + 4.9212598425196852, basepoint.Y - 3.2808398950131235, basepoint.Z);
			XYZ ePoint3 = new XYZ(basepoint.X + 3.2808398950131235, basepoint.Y, basepoint.Z);
			XYZ ePoint4 = new XYZ(basepoint.X + 3.2808398950131235, basepoint.Y - 1.6404199475065617, basepoint.Z);
			XYZ sPoint7 = new XYZ(basepoint.X + 4.9212598425196852, basepoint.Y, basepoint.Z);
			XYZ sPoint8 = new XYZ(basepoint.X + 4.9212598425196852, basepoint.Y - 1.6404199475065617, basepoint.Z);
			XYZ xyz7 = new XYZ(basepoint.X + 8.2020997375328086, basepoint.Y, basepoint.Z);
			XYZ xyz8 = new XYZ(basepoint.X + 8.2020997375328086, basepoint.Y - 1.6404199475065617, basepoint.Z);
			this.DrawDetailLine(sPoint, xyz, names[0]);
			this.DrawDetailLine(xyz2, ePoint, names[0]);
			this.DrawDetailLine(sPoint, xyz2, names[0]);
			this.DrawDetailLine(xyz, ePoint, names[0]);
			this.DrawDetailLine(sPoint4, xyz3, names[0]);
			this.DrawDetailLine(sPoint5, xyz4, names[1]);
			this.DrawDetailArcLine(xyz3, names[2]);
			this.DrawDetailArcLine(xyz4, names[2]);
			this.DrawDetailLine(sPoint6, xyz5, names[0]);
			this.DrawDetailLine(xyz6, ePoint2, names[0]);
			this.DrawDetailLine(sPoint6, xyz6, names[0]);
			this.DrawDetailLine(xyz5, ePoint2, names[0]);
			this.DrawDetailLine(sPoint7, xyz7, names[0]);
			this.DrawDetailLine(sPoint8, xyz8, names[1]);
			this.DrawDetailArcLine(xyz7, names[2]);
			this.DrawDetailArcLine(xyz8, names[2]);
			this.DrawDetailLine(sPoint2, ePoint3, names[3]);
			this.DrawDetailLine(sPoint3, ePoint4, names[4]);
		}

		public void DrawPipeLine(XYZ basepoint, string[] names, bool isSameDistance, int standpipecount)
		{
			XYZ ePoint = new XYZ(basepoint.X + (double)standpipecount * 49.212598425196852, basepoint.Y, basepoint.Z);
			this.DrawDetailLine(basepoint, ePoint, names[3]);
			XYZ sPoint = new XYZ(basepoint.X, basepoint.Y - 1.6404199475065617, basepoint.Z);
			XYZ xyz = new XYZ(basepoint.X + (double)standpipecount * 49.212598425196852 + 1.6404199475065617, basepoint.Y - 1.6404199475065617, basepoint.Z);
			this.DrawDetailLine(sPoint, xyz, names[4]);
			if (isSameDistance && standpipecount > 1)
			{
				XYZ sPoint2 = new XYZ(basepoint.X + 49.212598425196852 + 1.6404199475065617, basepoint.Y - 0.82020997375328086, basepoint.Z);
				XYZ ePoint2 = new XYZ(basepoint.X + (double)standpipecount * 49.212598425196852 + 1.6404199475065617, basepoint.Y - 0.82020997375328086, basepoint.Z);
				this.DrawDetailLine(sPoint2, ePoint2, names[4]);
				this.DrawDetailLine(xyz, ePoint2, names[4]);
			}
		}

		public void DrawPipeLineWithMark(XYZ basepoint, string[] names, bool isSameDistance, int standpipecount, Dictionary<int, string> dic)
		{
			XYZ ePoint = new XYZ(basepoint.X + (double)standpipecount * 49.212598425196852, basepoint.Y, basepoint.Z);
			this.DrawDetailLine(basepoint, ePoint, names[3]);
			XYZ xyz = new XYZ(basepoint.X, basepoint.Y - 1.6404199475065617, basepoint.Z);
			XYZ xyz2 = new XYZ(basepoint.X + (double)standpipecount * 49.212598425196852 + 1.6404199475065617, basepoint.Y - 1.6404199475065617, basepoint.Z);
			this.DrawDetailLine(xyz, xyz2, names[4]);
			if (isSameDistance && standpipecount > 1)
			{
				XYZ sPoint = new XYZ(basepoint.X + 49.212598425196852 + 1.6404199475065617, basepoint.Y - 0.82020997375328086, basepoint.Z);
				XYZ ePoint2 = new XYZ(basepoint.X + (double)standpipecount * 49.212598425196852 + 1.6404199475065617, basepoint.Y - 0.82020997375328086, basepoint.Z);
				this.DrawDetailLine(sPoint, ePoint2, names[4]);
				this.DrawDetailLine(xyz2, ePoint2, names[4]);
			}
			Dictionary<int, XYZ> dictionary = new Dictionary<int, XYZ>();
			for (int i = 1; i <= standpipecount; i++)
			{
				XYZ value = new XYZ(basepoint.X + 24.606299212598426 * (double)(2 * i - 1), basepoint.Y + 0.82020997375328086, basepoint.Z);
				dictionary.Add(i, value);
			}
			if (isSameDistance && standpipecount > 1)
			{
				XYZ xyz3 = new XYZ(basepoint.X + 49.212598425196852 + 1.6404199475065617, basepoint.Y - 0.82020997375328086, basepoint.Z);
				for (int j = 1; j < standpipecount; j++)
				{
					XYZ value2 = new XYZ(xyz3.X + 24.606299212598426 * (double)(2 * j - 1), xyz3.Y + 0.82020997375328086, xyz3.Z);
					dictionary.Add(j + standpipecount, value2);
				}
				XYZ value3 = new XYZ((xyz.X + xyz2.X) / 2.0, xyz.Y + 0.82020997375328086, xyz.Z);
				dictionary.Add(2 * standpipecount, value3);
			}
			else
			{
				for (int k = 1; k <= standpipecount; k++)
				{
					XYZ value4 = new XYZ(basepoint.X + 24.606299212598426 * (double)(2 * k - 1), basepoint.Y - 0.82020997375328086, basepoint.Z);
					dictionary.Add(k + standpipecount, value4);
				}
			}
			this.DrawMarkByPointDic(dictionary, dic, new XYZ(1.0, 0.0, 0.0));
		}

		public void DrawStanPipeLine(XYZ basepoint, string[] names, int levelCount, bool isSameDistance)
		{
			XYZ xyz = new XYZ(basepoint.X, basepoint.Y + (double)(levelCount + 1) * 9.84251968503937, basepoint.Z);
			this.DrawDetailLine(basepoint, xyz, names[3]);
			this.DrawValveLine(xyz, names);
			if (isSameDistance)
			{
				XYZ sPoint = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y - 0.82020997375328086, basepoint.Z);
				XYZ xyz2 = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y + (double)(levelCount + 1) * 9.84251968503937 - 1.6404199475065617, basepoint.Z);
				XYZ ePoint = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y + (double)(levelCount + 1) * 9.84251968503937, basepoint.Z);
				this.DrawDetailLine(sPoint, xyz2, names[4]);
				this.DrawDetailLine(xyz2, ePoint, names[4]);
				this.DrawValveLine(xyz2, names);
				XYZ sPoint2 = new XYZ(basepoint.X + 0.82020997375328086, basepoint.Y + 9.84251968503937 - 0.82020997375328086, basepoint.Z);
				XYZ ePoint2 = new XYZ(basepoint.X + 0.82020997375328086, basepoint.Y + (double)(levelCount + 1) * 9.84251968503937 - 1.6404199475065617, basepoint.Z);
				this.DrawDetailLine(sPoint2, ePoint2, names[4]);
				this.DrawDetailLine(xyz2, ePoint2, names[4]);
				return;
			}
			XYZ sPoint3 = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y - 1.6404199475065617, basepoint.Z);
			XYZ xyz3 = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y + (double)(levelCount + 1) * 9.84251968503937, basepoint.Z);
			this.DrawDetailLine(sPoint3, xyz3, names[4]);
			this.DrawValveLine(xyz3, names);
		}

		public void DrawStanPipeLineWithMark(XYZ basepoint, string[] names, bool isSameDistance, LevelMarkInfo levelMarkInfo)
		{
			XYZ xyz = new XYZ(basepoint.X, basepoint.Y + (double)(levelMarkInfo.count + 1) * 9.84251968503937, basepoint.Z);
			this.DrawDetailLine(basepoint, xyz, names[3]);
			this.DrawValveLine(xyz, names);
			if (isSameDistance)
			{
				XYZ sPoint = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y - 0.82020997375328086, basepoint.Z);
				XYZ xyz2 = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y + (double)(levelMarkInfo.count + 1) * 9.84251968503937 - 1.6404199475065617, basepoint.Z);
				XYZ xyz3 = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y + (double)(levelMarkInfo.count + 1) * 9.84251968503937, basepoint.Z);
				this.DrawDetailLine(sPoint, xyz2, names[4]);
				this.DrawDetailLine(xyz2, xyz3, names[4]);
				this.DrawValveLine(xyz3, names);
				XYZ sPoint2 = new XYZ(basepoint.X + 0.82020997375328086, basepoint.Y + 9.84251968503937 - 0.82020997375328086, basepoint.Z);
				XYZ ePoint = new XYZ(basepoint.X + 0.82020997375328086, basepoint.Y + (double)(levelMarkInfo.count + 1) * 9.84251968503937 - 1.6404199475065617, basepoint.Z);
				this.DrawDetailLine(sPoint2, ePoint, names[4]);
				this.DrawDetailLine(xyz2, ePoint, names[4]);
			}
			else
			{
				XYZ sPoint3 = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y - 1.6404199475065617, basepoint.Z);
				XYZ xyz4 = new XYZ(basepoint.X + 1.6404199475065617, basepoint.Y + (double)(levelMarkInfo.count + 1) * 9.84251968503937, basepoint.Z);
				this.DrawDetailLine(sPoint3, xyz4, names[4]);
				this.DrawValveLine(xyz4, names);
			}
			Dictionary<int, XYZ> dictionary = new Dictionary<int, XYZ>();
			for (int i = 1; i <= levelMarkInfo.count; i++)
			{
				XYZ value = new XYZ(basepoint.X - 0.82020997375328086, basepoint.Y + 9.84251968503937 * (double)(2 * i - 1) / 2.0, basepoint.Z);
				dictionary.Add(i, value);
			}
			if (isSameDistance)
			{
				XYZ xyz5 = new XYZ(basepoint.X, basepoint.Y + 9.84251968503937 - 0.82020997375328086, basepoint.Z);
				for (int j = 1; j < levelMarkInfo.count; j++)
				{
					XYZ value2 = new XYZ(xyz5.X, xyz5.Y + 9.84251968503937 * (double)(2 * j - 1) / 2.0 - 0.82020997375328086, xyz5.Z);
					dictionary.Add(j + levelMarkInfo.count, value2);
				}
				XYZ value3 = new XYZ(basepoint.X + 0.82020997375328086, (basepoint.Y - 0.82020997375328086 + (basepoint.Y + (double)(levelMarkInfo.count + 1) * 9.84251968503937)) / 2.0, basepoint.Z);
				dictionary.Add(levelMarkInfo.count * 2, value3);
			}
			else
			{
				for (int k = 1; k <= levelMarkInfo.count; k++)
				{
					XYZ value4 = new XYZ(basepoint.X + 0.82020997375328086, basepoint.Y + 9.84251968503937 * (double)(2 * k - 1) / 2.0 - 1.6404199475065617, basepoint.Z);
					dictionary.Add(k + levelMarkInfo.count, value4);
				}
			}
			this.DrawMarkByPointDic(dictionary, levelMarkInfo.dicMark, new XYZ(0.0, 1.0, 0.0));
		}

		public void DrawMarkByPointDic(Dictionary<int, XYZ> dicPoint, Dictionary<int, string> dic, XYZ Vec)
		{
			using (Dictionary<int, string>.Enumerator enumerator = dic.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					KeyValuePair<int, string> item = enumerator.Current;
					XYZ value = dicPoint.FirstOrDefault((KeyValuePair<int, XYZ> q) => q.Key == item.Key).Value;
					this.doc.GetTextNode(this.view, value, Vec, new XYZ(0.0, 1.0, 0.0), 0.00984251968503937, (Autodesk.Revit.DB.TextAlignFlags)64, item.Value, 6.0);
				}
			}
		}

		public void DrawValveLine(XYZ basepoint, string[] names)
		{
			XYZ sPoint = new XYZ(basepoint.X + 0.32808398950131235, basepoint.Y - 0.65616797900262469, basepoint.Z);
			XYZ ePoint = new XYZ(basepoint.X - 0.32808398950131235, basepoint.Y - 0.65616797900262469, basepoint.Z);
			XYZ sPoint2 = new XYZ(basepoint.X + 0.32808398950131235, basepoint.Y - 1.4763779527559056, basepoint.Z);
			XYZ ePoint2 = new XYZ(basepoint.X - 0.32808398950131235, basepoint.Y - 1.4763779527559056, basepoint.Z);
			this.DrawDetailLine(sPoint, ePoint, names[3]);
			this.DrawDetailLine(sPoint, ePoint2, names[3]);
			this.DrawDetailLine(sPoint2, ePoint2, names[3]);
			this.DrawDetailLine(sPoint2, ePoint, names[3]);
			XYZ xyz = new XYZ(basepoint.X + 0.41010498687664043, basepoint.Y - 0.20505249343832022, basepoint.Z);
			XYZ xyz2 = new XYZ(basepoint.X - 0.41010498687664043, basepoint.Y - 0.20505249343832022, basepoint.Z);
			XYZ xyz3 = new XYZ(basepoint.X + 0.41010498687664043, basepoint.Y + 0.41010498687664043, basepoint.Z);
			XYZ ePoint3 = new XYZ(basepoint.X - 0.41010498687664043, basepoint.Y + 0.41010498687664043, basepoint.Z);
			XYZ xyz4 = new XYZ(basepoint.X, basepoint.Y - 0.41010498687664043, basepoint.Z);
			XYZ sPoint3 = new XYZ(basepoint.X, basepoint.Y + 0.41010498687664043, basepoint.Z);
			XYZ ePoint4 = new XYZ(basepoint.X, basepoint.Y + 0.82020997375328086, basepoint.Z);
			this.DrawDetailLine(xyz3, ePoint3, names[3]);
			this.DrawDetailLine(xyz, xyz3, names[2]);
			this.DrawDetailLine(xyz2, ePoint3, names[2]);
			this.DrawDetailLine(sPoint3, ePoint4, names[5]);
			Curve curve = Arc.Create(xyz, xyz2, xyz4);
			CurveElement curveElement = this.doc.Create.NewDetailCurve(this.view, curve) as DetailArc;
			GraphicsStyle graphicsStyleByName = this.fpt.GetGraphicsStyleByName(names[3]);
			curveElement.LineStyle = graphicsStyleByName;
		}

		public void DrawTheSampleChart(XYZ basepoint, string[] names, Dictionary<int, int> levelCountDic, int stanPipeCount, bool isSameDisOut, bool isSameDisIn)
		{
			this.DrawPipeLine(basepoint, names, isSameDisOut, stanPipeCount);
			int i;
			int i2;
			for (i = 0; i < stanPipeCount; i = i2 + 1)
			{
				int value = levelCountDic.FirstOrDefault((KeyValuePair<int, int> q) => q.Key == i + 1).Value;
				XYZ xyz = new XYZ(basepoint.X + (double)(i + 1) * 49.212598425196852, basepoint.Y, basepoint.Z);
				this.DrawStanPipeLine(xyz, names, value, isSameDisIn);
				for (int j = 0; j < value; j++)
				{
					XYZ basepoint2 = new XYZ(xyz.X + 0.82020997375328086, xyz.Y + (double)(j + 1) * 9.84251968503937, basepoint.Z);
					this.DrawOneFloor(basepoint2, names);
				}
				i2 = i;
			}
		}

		public void DrawThePipeSampleChart(XYZ basepoint, string[] names, HeatingPrincipleDiagramPrameters hpdp)
		{
			this.DrawPipeLineWithMark(basepoint, names, hpdp.isSameDisOut, hpdp.stanPipeCount, hpdp.dic);
			int i;
			int num;
			for (i = 0; i < hpdp.stanPipeCount; i = num + 1)
			{
				LevelMarkInfo value = hpdp.dicLevelMarkInfo.FirstOrDefault((KeyValuePair<int, LevelMarkInfo> q) => q.Key == i + 1).Value;
				int count = value.count;
				XYZ xyz = new XYZ(basepoint.X + (double)(i + 1) * 49.212598425196852, basepoint.Y, basepoint.Z);
				this.DrawStanPipeLineWithMark(xyz, names, hpdp.isSameDisIn, value);
				int n;
				for (n = 0; n < count; n = num + 1)
				{
					XYZ basepoint2 = new XYZ(xyz.X + 0.82020997375328086, xyz.Y + (double)(n + 1) * 9.84251968503937, basepoint.Z);
					int value2 = value.dicBranch.FirstOrDefault((KeyValuePair<int, int> q) => q.Key == n + 1).Value;
					this.DrawOneFloor(basepoint2, names);
					num = n;
				}
				num = i;
			}
		}

		public void DrawHeatingOneFloor(XYZ basepoint, string[] names, int branchCount)
		{
			if (branchCount != 0)
			{
				XYZ xyz = new XYZ(basepoint.X - 0.82020997375328086, basepoint.Y, basepoint.Z);
				XYZ xyz2 = new XYZ(xyz.X - 4.9212598425196852, xyz.Y, xyz.Z);
				XYZ xyz3 = new XYZ(xyz.X - 1.6404199475065617, xyz.Y + 0.41010498687664043, xyz.Z);
				XYZ xyz4 = new XYZ(xyz3.X, xyz3.Y - 0.82020997375328086, xyz3.Z);
				XYZ xyz5 = new XYZ(xyz3.X - 1.6404199475065617, xyz3.Y, xyz3.Z);
				XYZ ePoint = new XYZ(xyz5.X, xyz5.Y - 0.82020997375328086, xyz5.Z);
				new XYZ(xyz2.X + 0.82020997375328086, xyz2.Y + 0.82020997375328086, xyz2.Z);
				this.DrawDetailLine(xyz, xyz2, names[3]);
				this.DrawDetailArcLine(xyz2, names[2]);
				this.DrawDetailLine(xyz3, xyz4, names[0]);
				this.DrawDetailLine(xyz5, ePoint, names[0]);
				this.DrawDetailLine(xyz4, xyz5, names[0]);
				this.DrawDetailLine(xyz3, ePoint, names[0]);
				XYZ xyz6 = new XYZ(basepoint.X + 0.82020997375328086, basepoint.Y - 1.6404199475065617, basepoint.Z);
				XYZ xyz7 = new XYZ(xyz6.X - 6.5616797900262469, xyz6.Y, xyz6.Z);
				XYZ xyz8 = new XYZ(xyz6.X - 3.2808398950131235, xyz6.Y + 0.41010498687664043, xyz6.Z);
				XYZ xyz9 = new XYZ(xyz8.X, xyz8.Y - 0.82020997375328086, xyz8.Z);
				XYZ xyz10 = new XYZ(xyz8.X - 1.6404199475065617, xyz8.Y, xyz8.Z);
				XYZ ePoint2 = new XYZ(xyz10.X, xyz10.Y - 0.82020997375328086, xyz10.Z);
				new XYZ(xyz7.X - 0.82020997375328086, xyz7.Y - 0.82020997375328086, xyz7.Z);
				this.DrawDetailLine(xyz6, xyz7, names[4]);
				this.DrawDetailArcLine(xyz7, names[2]);
				this.DrawDetailLine(xyz8, xyz9, names[0]);
				this.DrawDetailLine(xyz10, ePoint2, names[0]);
				this.DrawDetailLine(xyz9, xyz10, names[0]);
				this.DrawDetailLine(xyz8, ePoint2, names[0]);
				if (branchCount >= 2)
				{
					XYZ xyz11 = new XYZ(basepoint.X - 0.82020997375328086, basepoint.Y, basepoint.Z);
					XYZ xyz12 = new XYZ(xyz11.X + 6.5616797900262469, xyz11.Y, xyz11.Z);
					XYZ xyz13 = new XYZ(xyz11.X + 3.2808398950131235, xyz12.Y + 0.41010498687664043, xyz12.Z);
					XYZ xyz14 = new XYZ(xyz13.X, xyz13.Y - 0.82020997375328086, xyz13.Z);
					XYZ xyz15 = new XYZ(xyz13.X + 1.6404199475065617, xyz13.Y, xyz13.Z);
					XYZ ePoint3 = new XYZ(xyz14.X + 1.6404199475065617, xyz14.Y, xyz14.Z);
					new XYZ(xyz12.X - 0.82020997375328086, xyz12.Y + 0.82020997375328086, xyz12.Z);
					this.DrawDetailLine(xyz11, xyz12, names[3]);
					this.DrawDetailArcLine(xyz12, names[2]);
					this.DrawDetailLine(xyz13, xyz14, names[0]);
					this.DrawDetailLine(xyz15, ePoint3, names[0]);
					this.DrawDetailLine(xyz14, xyz15, names[0]);
					this.DrawDetailLine(xyz13, ePoint3, names[0]);
					XYZ xyz16 = new XYZ(basepoint.X + 0.82020997375328086, basepoint.Y - 1.6404199475065617, basepoint.Z);
					XYZ xyz17 = new XYZ(xyz16.X + 4.9212598425196852, xyz16.Y, xyz16.Z);
					XYZ xyz18 = new XYZ(xyz16.X + 1.6404199475065617, xyz16.Y + 0.41010498687664043, xyz16.Z);
					XYZ xyz19 = new XYZ(xyz18.X, xyz18.Y - 0.82020997375328086, xyz18.Z);
					XYZ xyz20 = new XYZ(xyz18.X + 1.6404199475065617, xyz18.Y, xyz18.Z);
					XYZ ePoint4 = new XYZ(xyz19.X + 1.6404199475065617, xyz19.Y, xyz19.Z);
					new XYZ(xyz17.X + 0.82020997375328086, xyz17.Y - 0.82020997375328086, xyz17.Z);
					this.DrawDetailLine(xyz16, xyz17, names[4]);
					this.DrawDetailArcLine(xyz17, names[2]);
					this.DrawDetailLine(xyz18, xyz19, names[0]);
					this.DrawDetailLine(xyz20, ePoint4, names[0]);
					this.DrawDetailLine(xyz19, xyz20, names[0]);
					this.DrawDetailLine(xyz18, ePoint4, names[0]);
				}
			}
		}

		public void DrawTheSampleChart(XYZ basepoint, string[] names, HeatingPrincipleDiagramPrameters hpdp)
		{
			this.DrawPipeLineWithMark(basepoint, names, hpdp.isSameDisOut, hpdp.stanPipeCount, hpdp.dic);
			int i;
			int num;
			for (i = 0; i < hpdp.stanPipeCount; i = num + 1)
			{
				LevelMarkInfo value = hpdp.dicLevelMarkInfo.FirstOrDefault((KeyValuePair<int, LevelMarkInfo> q) => q.Key == i + 1).Value;
				int count = value.count;
				XYZ xyz = new XYZ(basepoint.X + (double)(i + 1) * 49.212598425196852, basepoint.Y, basepoint.Z);
				this.DrawStanPipeLineWithMark(xyz, names, hpdp.isSameDisIn, value);
				int n;
				for (n = 0; n < count; n = num + 1)
				{
					XYZ basepoint2 = new XYZ(xyz.X + 0.82020997375328086, xyz.Y + (double)(n + 1) * 9.84251968503937, basepoint.Z);
					int value2 = value.dicBranch.FirstOrDefault((KeyValuePair<int, int> q) => q.Key == n + 1).Value;
					this.DrawHeatingOneFloor(basepoint2, names, value2);
					num = n;
				}
				num = i;
			}
		}

		private const double distance = 1.6404199475065617;

		private const double levelheight = 9.84251968503937;

		private const double standpipedistance = 49.212598425196852;

		private FloorPipeTools fpt;

		private Document doc;

		private Autodesk.Revit.DB.View view;
	}
}
